from django.db import models


class User(models.Model):
    username = models.CharField(max_length=1024)
    password = models.CharField(max_length=128)
    role = models.CharField(max_length=512)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)
    last_logined_at = models.DateTimeField()


class UserToken(models.Model):
    user_id = models.IntegerField(unique=True, primary_key=True)
    token = models.CharField(max_length=128)
    deleted = models.SmallIntegerField()
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)


class UserDescription(models.Model):
    class Meta:
        unique_together = ('user_id', 'supervisor_id', 'merchant_id')

    user_id = models.IntegerField()
    supervisor_id = models.IntegerField()
    merchant_id = models.IntegerField()
    description = models.CharField(max_length=1024)
